//
//  FQUpdateImageView.swift
//  SwiftProject
//
//  Created by 董駸 on 2022/8/22.
//

import UIKit

enum FQUpdateType {
    case face
    case back
}

class FQUpdateImageView: QMUIButton {
    
    var updateType : FQUpdateType = .back
    var status : Bool = false {
        didSet {
            if status {
                
            }
        }
    }
    
    convenience init(_ updateType : FQUpdateType) {
        self.init()
        self.updateType = updateType
        isUserInteractionEnabled = true
        
        let button = QMUIButton()
        button.isUserInteractionEnabled = false
        button.spacingBetweenImageAndTitle = 3
        button.imagePosition = .top
        button.setImage(UIImage(named: "icon_update"), for: .normal)
        button.titleLabel?.font = .rSFont(12)
        button.setTitleColor(.color17, for: .normal)
        addSubview(button)
        
        button.snp.makeConstraints { make in
            make.center.equalToSuperview()
        }
        
        switch updateType {
        case .back:
            tag = 2
            setBackgroundImage(UIImage(named: "icon_cerification_back"), for: .normal)
            button.setTitle("上传国徽面", for: .normal)
        case .face:
            tag = 1
            setBackgroundImage(UIImage(named: "icon_cerification_face"), for: .normal)
            button.setTitle("上传人像面", for: .normal)
        }
        
    }
}
